/* Reset and base styles optimized for iframe and mobile-first design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

/* Main container with responsive height handling */
.game-container {
    width: 100%;
    height: 450px; /* Default iframe height */
    max-height: 90vh; /* For standalone browser */
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

/* Progress tracking - compact design */
.progress-container {
    padding: 8px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 20%;
}

.progress-text {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

/* Main game screen layout */
.game-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
    overflow-y: auto;
}

/* Scene and character container */
.scene-container {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 8px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.character-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.avatar-image {
    width: 40px;
    height: 40px;
    background: #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.character-name {
    font-size: 10px;
    font-weight: 600;
    color: #495057;
    text-align: center;
}

.scene-background {
    flex: 1;
    height: 40px;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

/* Dialogue box with cognitive load optimization */
.dialogue-container {
    flex: 1;
    min-height: 80px;
}

.dialogue-box {
    background: #ffffff;
    border: 2px solid #007bff;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 12px rgba(0, 123, 255, 0.1);
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.dialogue-box::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #007bff;
}

.dialogue-text {
    font-size: 14px;
    line-height: 1.4;
    color: #212529;
    text-align: left;
    word-wrap: break-word;
}

/* Decision buttons with touch-friendly design */
.decision-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.decision-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
    min-height: 44px; /* Touch-friendly minimum */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
}

.decision-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    background: linear-gradient(135deg, #218838, #1ea085);
}

.decision-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.2);
}

.decision-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Navigation controls */
.navigation-container {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    min-height: 50px;
    align-items: center;
}

.nav-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.nav-btn.primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Score display */
.score-container {
    display: flex;
    gap: 12px;
    padding: 6px 12px;
    background: #e9ecef;
    font-size: 11px;
    min-height: 30px;
    align-items: center;
}

.score-item {
    display: flex;
    gap: 4px;
    align-items: center;
}

.score-label {
    color: #495057;
    font-weight: 500;
}

.score-value {
    color: #007bff;
    font-weight: 700;
}

/* Tooltip for additional information */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    max-width: 200px;
    text-align: center;
    line-height: 1.3;
}

.tooltip.show {
    opacity: 1;
}

/* Responsive design for larger screens */
@media (min-height: 500px) {
    .game-container {
        height: 90vh;
    }
    
    .game-screen {
        padding: 16px;
        gap: 12px;
    }
    
    .dialogue-text {
        font-size: 15px;
    }
    
    .decision-btn {
        font-size: 14px;
        padding: 12px 16px;
        min-height: 48px;
    }
}

/* Mobile landscape optimization */
@media (orientation: landscape) and (max-height: 500px) {
    .progress-container {
        padding: 4px 12px;
        min-height: 32px;
    }
    
    .game-screen {
        padding: 8px;
        gap: 6px;
    }
    
    .scene-container {
        min-height: 50px;
    }
    
    .navigation-container {
        padding: 6px 12px;
        min-height: 42px;
    }
}

/* Animation classes for enhanced user experience */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Highlight effects for interactive elements */
.highlight {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
    transform: scale(1.02);
}

.success-highlight {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
    background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.warning-highlight {
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3);
    background: linear-gradient(135deg, #ffc107, #e0a800) !important;
}